package com.OrderingServer.Controller.seller;

import com.OrderingServer.pojo.Loginlog;
import com.OrderingServer.pojo.ProductCategory;
import com.OrderingServer.service.ILoginlogService;
import com.OrderingServer.utils.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "登录日志接口")
@RestController
@ApiResponses({
        @ApiResponse(code = 200,message = "新增成功" ,response = ProductCategory.class),
        @ApiResponse(code = 400,message = "参数错误" ),
        @ApiResponse(code = 403,message = "权限被禁止" ),
        @ApiResponse(code = 500,message = "服务器内部错误" ),
})
@Slf4j
@RequestMapping("/loginlog")
public class loginController {
    @Autowired
    ILoginlogService loginlogService;
    @GetMapping("selectPage")
    public Result getAllByPage(@RequestParam(defaultValue = "1")Integer pageNum,
                               @RequestParam(defaultValue = "5")Integer pageSize,
                               @RequestParam String userName){
        PageInfo<Loginlog> pageInfo =loginlogService.selectPage(pageNum,pageSize,userName);
        return  Result.success(pageInfo);
    }

}
